package com.endava.Generics;

import java.util.ArrayList;
import java.util.List;

/*3. Write a generic method to exchange the positions of two different elements in an array.*/
public class Ex3 {

	public static void main(String[] args) {

		List<Integer> list = new ArrayList<Integer>();
		list.add(1);
		list.add(2);

		System.out.println(Ex3.number(list));
	}

	public static <T extends Number> int number(List<Integer> list) {
		int x=list.get(0);
		int y=list.get(1);
		x=y;
		y=list.get(0);
		System.out.println(x);
		System.out.println(y);
		return x;
		

	}
}
